package com.hf.job

import com.hf.bill.MailBillLastWorkdayOfPeriodService
import com.hf.bill.MailBillOfMonthAdminService
import com.hf.constant.OrderLunchConst
import com.hf.fetch.MailFetchService
import com.hf.init.InitService
import com.hf.order.MailOrderService
import com.hf.security.MailOweMoneyReminderService
import com.hf.security.SystemConfigService

class MyJob {

	InitService initService
	MailOrderService mailOrderService
	MailFetchService mailFetchService

	MailBillLastWorkdayOfPeriodService mailBillLastWorkdayOfPeriodService
	MailOweMoneyReminderService mailOweMoneyReminderService
	MailBillOfMonthAdminService mailBillOfMonthAdminService
	
	SystemConfigService systemConfigService

	static triggers = {
		simple startDelay:1000, repeatInterval: 1000, repeatCount: 0
	}

	def execute() {
		// execute job
		log.info "job run!"
		boolean isTest = false
		OrderLunchConst.IS_TEST = isTest

		if (isTest) {
//			initService.init()
//						mailOrderService.sendMail()
			//			mailFetchService.sendMail()

			// 	period
//			mailBillLastWorkdayOfPeriodService.sendMail()
//			mailOweMoneyReminderService.sendMail()
//			mailBillOfMonthAdminService.sendMail()
		}
		/*
		 * send bill
//		mailBillLastWorkdayOfPeriodService.sendMail()
//		systemConfigService.setBillDayOfNextPeriod()
*/
	}
}
